import request from '@/utils/request'

// 查询流程任务信息列表
export function listBpmTask(query) {
  return request({
    url: '/flowable/bpmTask/list',
    method: 'get',
    params: query
  })
}

// 查询流程任务信息详细
export function getBpmTask(id) {
  return request({
    url: '/flowable/bpmTask/' + id,
    method: 'get'
  })
}

// 新增流程任务信息
export function addBpmTask(data) {
  return request({
    url: '/flowable/bpmTask',
    method: 'post',
    data: data
  })
}

// 修改流程任务信息
export function updateBpmTask(data) {
  return request({
    url: '/flowable/bpmTask',
    method: 'put',
    data: data
  })
}

// 删除流程任务信息
export function delBpmTask(id) {
  return request({
    url: '/flowable/bpmTask/' + id,
    method: 'delete'
  })
}
//查询已完成流程列表
export function finishList(query) {
  return request({
    url: '/flowable/bpmTask/finish',
    method: 'get',
    params: query
  })
}

/**
 * 审批通过节点
 * @param data
 * @returns {*}
 */
export function complete(data) {
  return request({
    url: '/flowable/bpmTask/complete',
    method: 'post',
    data: data
  })
}


/**
 * 审批驳回节点
 * @param data
 * @returns {*}
 */
export function reject(data) {
  return request({
    url: '/flowable/bpmTask/reject',
    method: 'post',
    data: data
  })
}

/**
 * 审批委派节点
 * @param data
 * @returns {*}
 */
export function delegate(data) {
  return request({
    url: '/flowable/bpmTask/delegate',
    method: 'post',
    data: data
  })
}


/**
 * 审批转办节点
 * @param data
 * @returns {*}
 */
export function transfer(data) {
  return request({
    url: '/flowable/bpmTask/transfer',
    method: 'post',
    data: data
  })
}


/**
 * 获得下一节点信息
 * @param query
 * @returns {*}
 */
export function getNextNodeMessage(query) {
  return request({
    url: '/flowable/bpmTask/getNextNodeMessage',
    method: 'get',
    params: query
  })
}


//查询流程定义节点
export function getNodeList(query) {
  return request({
    url: '/flowable/bpmTask/getNodeList',
    method: 'get',
    params: query
  })
}



export function freeFlowTask(data) {
  return request({
    url: '/flowable/bpmTask/freeFlowTask',
    method: 'post',
    data: data
  })
}
